const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

class UnionFindSet {
    constructor(n) {
        this.count = n
        this.fa = new Array(n).fill(null).map((val, index) => index)
    }

    find(x) {
        if (this.fa[x] !== x) {
            this.fa[x] = this.find(this.fa[x])
        }
        return this.fa[x]
    }

    union(x, y) {
        let rootX = this.find(x)
        let rootY = this.find(y)
        if (rootX !== rootY) {
            this.fa[rootY] = rootX
            this.count--
            return true
        }
        return false
    }
}

let n;
let initArr = [];
rl.on("line", (line) => {
    if (n === undefined) {
        n = Number(line.trim())
    } else {
        if (line.trim() === "") {
            getResult(initArr, n)

            // clear
            n = undefined;
            initArr.length = 0
            return
        }
        initArr.push(line.trim().split(" ").map(Number))
    }
})

function getResult(initArr, n) {
    let obj = {}

    let count = Infinity;
    let ans = []
    for (let i = 1; i <= n; i++) {
        let us = new UnionFindSet(n + 1)
        for (const [a, b] of initArr) {
            if (a === i || b === i) {
                continue
            }
            us.union(a, b)
        }
        for (let j = 0; j < us.fa.length; j++) {
            us.find(j)
        }
        let countObj = {}
        for (let j = 0; j < us.fa.length; j++) {
            let key = us.fa[j]
            if (!countObj[key]) {
                countObj[key] = 1
            } else {
                countObj[key]++
            }
        }
        // 找重复最多的

        let size = Math.max(...Object.values(countObj))
        if (count > size) {
            count = size
            ans = [i]
        } else if (count === size) {
            ans.push(i)
        }
    }
    console.log(ans.join(" "))
}